import request from '@/utils/request'

// 创建订单
export const createOrder = (data: any) => {
  return request({
    url: '/order/create',
    method: 'post',
    data,
  })
}

// 获取订单详情
export const getOrderDetail = (orderId: string) => {
  return request({
    url: `/order/${orderId}`,
    method: 'get',
  })
}

// 获取支付方式列表
export const getPaymentTypes = () => {
  return request({
    url: '/payment/types',
    method: 'get',
  })
}

// 创建支付订单
export const createPayment = (data: any) => {
  return request({
    url: '/payment/create',
    method: 'post',
    data,
  })
}

// 查询支付状态
export const queryPaymentStatus = (paymentId: string) => {
  return request({
    url: `/payment/${paymentId}/status`,
    method: 'get',
  })
}

// 取消订单
export const cancelOrder = (orderId: string) => {
  return request({
    url: `/order/${orderId}/cancel`,
    method: 'post',
  })
}
